<!DOCTYPE html>
<!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Bootstrap core CSS -->
    <link th:href="@{../asserts/css/bootstrap.min.css}" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link th:href="@{../asserts/css/dashboard.css}" rel="stylesheet">
    <style type="text/css">
        @-webkit-keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        @keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        .chartjs-render-monitor {
            -webkit-animation: chartjs-render-animation 0.001s;
            animation: chartjs-render-animation 0.001s;
        }

        .hidden {
            display: none !important;
        }
    </style>
</head>

<body>
<div th:replace="commons/bar::topbar"></div>
<div class="container-fluid">
    <div class="row">
        <!--引入侧边栏-->
        <div th:replace="commons/bar::sidebar(activeUri='employees')"></div>
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <th:block th:if="${employeeUser ne null}">
                <h2>Изменить сотрудника</h2>
            </th:block>
            <th:block th:if="${employeeUser eq null}">
                <h2>Добавить сотрудника</h2>
            </th:block>
            <form th:action="@{/employee}" method="post">
                <input type="hidden" name="_method" value="put" th:if="${employeeUser ne null}">
                <div class="form-group hidden">
                    <th:block th:if="${employeeUser eq null}">
                        <label for="id1"></label>
                        <input type="text" class="form-control" id="id1" name="id" th:value="${employeeUser ne null}?${employeeUser.id}">
                    </th:block>
                    <th:block th:if="${employeeUser ne null}">
                        <label for="id"></label>
                        <input type="text" class="form-control" id="id" name="id" th:value="${employeeUser ne null}?${employeeUser.id}">
                    </th:block>
                </div>
                <div class="form-group">
                    <label for="username">Имя пользователя</label>
                    <input type="text" class="form-control" id="username" name="username" th:value="${employeeUser ne null}?${employeeUser.username}" required>
                </div>
                <div class="form-group">
                    <label for="password">Пароль</label>
                    <input type="text" class="form-control" id="password" name="password" th:value="${employeeUser ne null}?${employeeUser.password}" required>
                </div>
                <div class="form-group hidden">
                    <label for="employeeCode"></label>
                    <input type="text" class="form-control" id="employeeCode" name="employeeCode" th:value="${employeeUser ne null}?${employeeUser.employeeCode}">
                </div>
                <fieldset class="form-group">
                    <legend class="col-form-label pt-0">Пол</legend>
                    <div class="custom-control custom-radio custom-control-inline">
                        <input type="radio" id="employeeGender1" name="employeeGender"
                               class="custom-control-input" value="01"
                               th:checked="${employeeUser ne null}?${employeeUser.employeeGender} eq '01'">
                        <label class="custom-control-label" for="employeeGender1">Мужчина</label>
                    </div>
                    <div class="custom-control custom-radio custom-control-inline">
                        <input type="radio" id="employeeGender2" name="employeeGender"
                               class="custom-control-input" value="02"
                               th:checked="${employeeUser ne null}?${employeeUser.employeeGender} eq '02'">
                        <label class="custom-control-label" for="employeeGender2">Женский пол</label>
                    </div>
                </fieldset>
                <div class="form-group">
                    <label for="employeePhone">Телефон сотрудника</label>
                    <input type="text" class="form-control" id="employeePhone" name="employeePhone" th:value="${employeeUser ne null}?${employeeUser.employeePhone}" required>
                </div>
                <div class="form-group">
                    <label for="inputFourthLevel">Местоположение сотрудника</label>
                    <select id="inputFourthLevel" class="form-control" name="employeeLocation">
                        <option>Выбирать...</option>
                        <option th:each="fourth : ${fourthLevel}" th:text="${fourth.fourthLevelName}"
                                th:value="${fourth.fourthLevelName}" th:selected="${employeeUser ne null}?${fourth.getFourthLevelName() eq employeeUser.employeeLocation}"></option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="datetimepicker">День рождения сотрудника</label>
                    <div class="input-append date" id="datetimepicker" data-date="" data-date-format="dd/mm/yyyy">
                        <input id="employeeBirthday" class="form-control" type="text"
                               th:value="${employeeUser ne null}?${#dates.format(employeeUser.employeeBirthday,'dd/MM/yyyy')}"
                               name="employeeBirthday" required>
                        <span class="add-on"><i class="icon-th"></i></span>
                    </div>
                </div>
                <div class="form-group">
                    <label for="datetimepicker2">Дата поступления работника</label>
                    <div class="input-append date" id="datetimepicker2" data-date="" data-date-format="dd/mm/yyyy">
                        <input id="employeeEntryDate" class="form-control" type="text"
                               th:value="${employeeUser ne null}?${#dates.format(employeeUser.employeeEntryDate,'dd/MM/yyyy')}"
                               name="employeeEntryDate" required>
                        <span class="add-on"><i class="icon-th"></i></span>
                    </div>
                </div>
                <div class="form-group">
                    <label for="employeeBankcard">Сотрудник банковской карты</label>
                    <input type="text" class="form-control" id="employeeBankcard" name="employeeBankcard" th:value="${employeeUser ne null}?${employeeUser.employeeBankcard}" required>
                </div>
                <fieldset class="form-group">
                    <legend class="col-form-label pt-0">Сотрудник является штаб-квартирой</legend>
                    <div class="custom-control custom-radio custom-control-inline">
                        <input type="radio" id="employeeIsHeadquarter1" name="employeeIsHeadquarter"
                               class="custom-control-input" value="01"
                               th:checked="${employeeUser ne null}?${employeeUser.employeeIsHeadquarter} eq '01'">
                        <label class="custom-control-label" for="employeeIsHeadquarter1">Да</label>
                    </div>
                    <div class="custom-control custom-radio custom-control-inline">
                        <input type="radio" id="employeeIsHeadquarter2" name="employeeIsHeadquarter"
                               class="custom-control-input" value="02"
                               th:checked="${employeeUser ne null}?${employeeUser.employeeIsHeadquarter} eq '02'">
                        <label class="custom-control-label" for="employeeIsHeadquarter2">Нет</label>
                    </div>
                </fieldset>

                <div class="form-group">
                    <label for="employeeSalary">Зарплата работника</label>
                    <div class="input-group">
                        <input type="text" class="form-control" id="employeeSalary" name="employeeSalary" th:value="${employeeUser ne null}?${employeeUser.employeeSalary}">
                        <div class="input-group-prepend">
                            <div class="input-group-text">₽</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="employeeShopId">Идентификатор сотрудника магазина</label>
                    <select id="employeeShopId" class="form-control" name="employeeShopId">
                        <option>Выбирать...</option>
                        <option th:each="shopInfo : ${shopInfos}" th:text="${shopInfo.shopId}"
                                th:value="${shopInfo.shopId}" th:selected="${employeeUser ne null}?${shopInfo.shopId eq employeeUser.employeeShopId}"></option>
                    </select>
                </div>

                <div class="form-group">
                    <label for="roles">Роль</label>
                    <select id="roles" class="form-control" name="roles[0].id">
                        <option>Выбирать...</option>
                        <option th:each="role : ${roles}" th:text="${role.description}"
                                th:value="${role.id}" th:selected="${employeeUser ne null}?${role.id eq userRoleKey.roleId}"></option>
                    </select>
                </div>

                <div class="form-group">
                    <input type="submit" class="btn btn-primary" value="Представить" onclick="createShop()">
                </div>
            </form>
        </main>
    </div>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="../../asserts/js/jquery-3.2.1.slim.min.js"></script>
<script type="text/javascript" src="../asserts/js/popper.min.js"></script>
<script type="text/javascript" src="../asserts/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../asserts/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="../asserts/js/locales/bootstrap-datetimepicker.ru.js"></script>

<!-- Icons -->
<script type="text/javascript" src="../asserts/js/feather.min.js"></script>
<script>
    feather.replace()
</script>

<!-- Graphs -->
<script type="text/javascript" src="../asserts/js/Chart.min.js"></script>
<script>
    $('#datetimepicker').datetimepicker({
        language: 'ru',
        minView: 'month',
        autoclose: true,
        setStartDate: new Date(),
        todayBtn: true,
        todayHighlight: true,
        keyboardNavigation: true
    }).on('changeDate', function (ev) {
        $(this).datetimepicker('hide');
    });

    $('#datetimepicker2').datetimepicker({
        language: 'ru',
        minView: 'month',
        autoclose: true,
        setStartDate: new Date(),
        todayBtn: true,
        todayHighlight: true,
        keyboardNavigation: true
    }).on('changeDate', function (ev) {
        $(this).datetimepicker('hide');
    });
</script>
<script>
    function createShop() {
        $('#id1').val(new Date().getMilliseconds());

        $('#employeeCode').val('10000' + new Date().getMilliseconds());
    }
</script>

</body>

</html>